package
{
	import de.polygonal.math.PM_PRNG;
	
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.utils.getTimer;
	
	public class skipquad extends Sprite
	{
		
		public function skipquad()
		{
			Global.prng = new PM_PRNG();
			Global.prng.seed = 1234;
			
			var points:Vector.<Point> = generateRandomPoints();
			var skipQuad:SkipQuadtree = new SkipQuadtree();
			var skipList:SkipList = new SkipList();
			var i:int, il:int;
			
			
			startTime = getTimer();
			var values:Array = new Array();
			for(i = 0, il = points.length; i < il; i++){
				values.push(points[i].x);
				values.sort(Array.NUMERIC);
			}
			
			trace(getTimer() - startTime);			
			
			var startTime:int = getTimer();
			for(i = 0, il = points.length; i < il; i++){
				//skipQuad.insert(points[i]);	
				skipList.insert(points[i].x);
			}
			var values2:Array = skipList.getSortedList();	
			trace(getTimer() - startTime);

			
		}
		
		private function generateRandomPoints():Vector.<Point>{
			var i:int;
			var points:Vector.<Point> = new Vector.<Point>;
			for(i = 0; i < 10000; i++){
				points.push(new Point(Global.prng.nextIntRange(0,100000), Global.prng.nextIntRange(0,100000)));
			}
			
			return points;
		}
	}
}